<?php
/**
 *
 * @author yuqi
 *        
 *        
 */

class RegistForm extends CFormModel
{
	public $username;
	public $password;
	public $configPwd;
	public $email;
	public $verifyCode;
	
	/**
	 * Declares the validation rules.
	 */
	public function rules()
	{
		return array(
				//username,password,configPwd,email are required
				array('username,password,configPwd,email','required'),
				//password and configPwd must be the same
				array('configPwd','compare','compareAttribute'=>'password'),
				// email has to be a valid email address
				array('email', 'email'),
				// verifyCode needs to be entered correctly
				array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
				array('username,email','unique','className'=>'User'),
				);
				
	}
	
	/**
	 * Declares customized attribute labels.
	 * If not declared here, an attribute would have a label that is
	 * the same as its name with the first letter in upper case.
	 */
	public function attributeLabels()
	{
		return array(
				'verifyCode'=>'Verification Code',
		);
	}
	
	
// 	public function regist(){
// 		return true;
// 	}
}

?>